/*******************************************************************************************
Copyright (C) 2011 Mestrelab Research S.L. All rights reserved.

This file is part of the MNova scripting toolkit.

Authorized users of MNova Software may use this file freely, but this file is provided AS IS
with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE.
*******************************************************************************************/ 

function getSaveFileNameTest()
{
	var fn = FileDialog.getSaveFileName(); // No parameters
	print(fn);

	fn = FileDialog.getSaveFileName("Spectra (*.spc);;Molecules (*.mol)"); // File filter parameter
	print(fn);

	fn = FileDialog.getSaveFileName("Spectra (*.spc);;Molecules (*.mol)", "Save Your Data"); // File filter and dialog name parameters
	print(fn);

	fn = FileDialog.getSaveFileName("", "", Dir.temp()); // Empty file filter and dialog name parameters, and start directory parameter
	print(fn);

	fn  = FileDialog.getSaveFileName("*.txt*","",Dir.temp(),4); //Don´t ask for confirmation
	print(fn);

 	fn = FileDialog.getSaveFileName("*.txt*","",Dir.temp(),0);//Asks for confirmation
	print(fn);
}

function getOpenFileNameTest()
{
	var fn = FileDialog.getOpenFileName(); // No parameters
	print(fn);

	fn = FileDialog.getOpenFileName("Spectra (*.spc, *.nmr, *.fid);;Molecules (*.mol)"); // File filter parameter
	print(fn);

	fn = FileDialog.getOpenFileName("Spectra (*.spc);;Molecules (*.mol)", "Open Your Data"); // File filter and dialog name parameters
	print(fn);

	fn = FileDialog.getOpenFileName("", "", Dir.temp()); // Empty file filter and dialog name parameters, and start directory parameter
	print(fn);
}

function getOpenFileNamesTest()
{
	var fn = FileDialog.getOpenFileNames(); // No parameters
	print(fn);

	fn = FileDialog.getOpenFileNames("Spectra (*.spc, *.nmr, *.fid);;Molecules (*.mol)"); // File filter parameter
	print(fn);

	fn = FileDialog.getOpenFileNames("Spectra (*.spc);;Molecules (*.mol)", "Open Your Data"); // File filter and dialog name parameters
	print(fn);

	fn = FileDialog.getOpenFileNames("", "", Dir.temp()); // Empty file filter and dialog name parameters, and start directory parameter
	print(fn);
}

function getExistingDirectoryTest()
{
	var dn = FileDialog.getExistingDirectory(); 
	print(dn);

	dn = FileDialog.getExistingDirectory(Dir.temp()); 
	print(dn);

	dn = FileDialog.getExistingDirectory(Dir.home(), "Select Directory"); 
	print(dn);
}

function fileDialogTest()
{
	getSaveFileNameTest();
	getOpenFileNameTest();
	getOpenFileNamesTest();
	getExistingDirectoryTest();
}